package org.demo.patten.flyweight;

/**
 * @author zhuj
 * @date 2025/3/22
 * @apiNote
 * 享元模式
 */
public class Forest {
    public static void main(String[] args) {
        for (int i = 0; i < 100000; i++) {
            TreeType tree = TreeFactory.getTreeType("松树", "绿色", "/res/pine.png");
            int x = (int) (Math.random() * 1000);
            int y = (int) (Math.random() * 1000);
            tree.display(x, y);
        }
        System.out.println("总共树种对象数量：" + TreeFactory.getTotalTypes());
    }
}
